import React from "react";
import '../../../static/css/pc/imagetext.less';
import PropTypes from "prop-types";

export default class ImageText extends React.Component{
	constructor(){
		super();
		this.state = {
			imagetextNews:[]
		}
	}
	componentDidMount(){
		var result=fetch("http://www.wwtliu.com/sxtstu/news/juhenews.php?type="+this.props.type+"&count="+this.props.count,{
			method:'get'
		})
		.then(res =>{
			return res.json()
		})
		.then(json =>{
			this.setState({
				imagetextNews:json
			})
		})
	}
	render(){
		var {imagetextNews}=this.state;
		console.log(imagetextNews)
		return(
			<div className='imagetext'>
				{
					imagetextNews.map((item,index)=>{
						return (
							<div className='imagetextShow' key={item.uniquekey}>
								<div className='title'>
									<p className='category'>{item.category}</p>
									<a href={item.url} className='title_t'>{item.title}</a>
									<p className='date'>{item.date}</p>
								</div>
								<p className='IMGShow'>
									<img src={item.thumbnail_pic_s}  className='IMG'/>
									<img src={item.thumbnail_pic_s02}  className='IMG IMG2'/>
									<img src={item.thumbnail_pic_s03}  className='IMG'/>
								</p>
							</div>
						)
					})
				}
			</div>
		)
	}
}
ImageText.propTypes = {
	type:PropTypes.string,
	count:PropTypes.number
}